/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package hu.rsc.feeds.client.gui;

import hu.rsc.feeds.client.Feeds;
import hu.rsc.feeds.client.data.Dictionary;
import hu.rsc.feeds.client.data.InitData;
import hu.rsc.feeds.client.gui.generated.FeedsPanel;
import hu.rsc.feeds.client.gui.generated.GeneratedPanel;
import hu.rsc.feeds.client.gui.generated.SystemPanel;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PasswordTextBox;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

/**
 * 
 * @author arbuckle
 */
public class LoginPanel extends Composite {
    Feeds parent;
    TextBox userName;
    PasswordTextBox password;
    HorizontalPanel hp = new HorizontalPanel();

    public LoginPanel(final Feeds parent) {
	this.parent = parent;
	this.hp.setWidth("100%");
	this.hp.clear();
	if (parent.userInfo == null) {
	    this.hp.add(getLoginForm());
	} else {
	    this.hp.add(getLoginedForm());
	}
	this.hp.add(getInfoTable());
	initWidget(this.hp);
    }

    public Widget getLoginedForm() {
	FlexTable main = new FlexTable();
	main.addStyleName("form");
	main.addStyleName("border");
	main.setWidth("100%");
	Label welcomelb = new Label();
	welcomelb.setText(Dictionary.getEntry(Dictionary.LABEL_WELCOME, welcomelb));
	welcomelb.addStyleName("formtitle");
	main.setWidget(0, 0, welcomelb);
	main.setWidget(1, 0, new Label(this.parent.userInfo.getUserName()));
	Button exit = new Button();
	exit.setText(Dictionary.getEntry(Dictionary.BUTTON_LOGOUT, exit));
	exit.addClickHandler(new ClickHandler() {

	    @Override
	    public void onClick(ClickEvent event) {
		LoginPanel.this.parent.service.logout(new AsyncCallback<InitData>() {

		    @Override
		    public void onFailure(Throwable caught) {
		    }

		    @Override
		    public void onSuccess(InitData result) {
			LoginPanel.this.parent.refresh(result);
		    }
		});

	    }
	});
	main.setWidget(2, 0, exit);

	Button settings = new Button();
	settings.setText(Dictionary.getEntry(Dictionary.BUTTON_SETTINGS, settings));
	settings.addClickHandler(new ClickHandler() {

	    @Override
	    public void onClick(ClickEvent event) {
		final SettingsPopup popup = new SettingsPopup(LoginPanel.this.parent);
		final int x = event.getNativeEvent().getClientX();
		final int y = event.getNativeEvent().getClientY();
		popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {

		    @Override
		    public void setPosition(int offsetWidth, int offsetHeight) {
			int left = x;
			int top = y;
			popup.setPopupPosition(left, top);
		    }
		});
	    }
	});

	Button profileBt = new Button();
	profileBt.setText(Dictionary.getEntry(Dictionary.BUTTON_PROFILE, profileBt));
	profileBt.addClickHandler(new ClickHandler() {

	    @Override
	    public void onClick(ClickEvent event) {
		final RegisterPopup popup = new RegisterPopup(LoginPanel.this.parent);
		final int x = event.getNativeEvent().getClientX();
		final int y = event.getNativeEvent().getClientY();
		popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {

		    @Override
		    public void setPosition(int offsetWidth, int offsetHeight) {
			int left = x;
			int top = y;
			popup.setPopupPosition(left, top);
		    }
		});
	    }
	});

	Button generatedBt = new Button();
	generatedBt.setText(Dictionary.getEntry(Dictionary.BUTTON_OWN_CHANELS, generatedBt));
	generatedBt.addClickHandler(new ClickHandler() {

	    @Override
	    public void onClick(ClickEvent event) {
		final GeneratedPanel popup = new GeneratedPanel();
		final int x = event.getNativeEvent().getClientX();
		final int y = event.getNativeEvent().getClientY();
		popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {

		    @Override
		    public void setPosition(int offsetWidth, int offsetHeight) {
			int left = x;
			int top = y;
			popup.setPopupPosition(left, top);
		    }
		});
	    }
	});

	Button systemBt = new Button();
	systemBt.setText(Dictionary.getEntry(Dictionary.BUTTON_SYSTEM_CHANELS, systemBt));
	systemBt.addClickHandler(new ClickHandler() {

	    @Override
	    public void onClick(ClickEvent event) {
		final SystemPanel popup = new SystemPanel();
		final int x = event.getNativeEvent().getClientX();
		final int y = event.getNativeEvent().getClientY();
		popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {

		    @Override
		    public void setPosition(int offsetWidth, int offsetHeight) {
			int left = x;
			int top = y;
			popup.setPopupPosition(left, top);
		    }
		});
	    }
	});

	Button feedsBt = new Button();
	feedsBt.setText(Dictionary.getEntry(Dictionary.BUTTON_OFFERED_CHANELS, feedsBt));
	feedsBt.addClickHandler(new ClickHandler() {

	    @Override
	    public void onClick(ClickEvent event) {
		final FeedsPanel popup = new FeedsPanel();
		final int x = event.getNativeEvent().getClientX();
		final int y = event.getNativeEvent().getClientY();
		popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {

		    @Override
		    public void setPosition(int offsetWidth, int offsetHeight) {
			int left = x;
			int top = y;
			popup.setPopupPosition(left, top);
		    }
		});
	    }
	});

	HorizontalPanel buttonPanel = new HorizontalPanel();
	buttonPanel.add(settings);
	buttonPanel.add(profileBt);
	buttonPanel.add(generatedBt);
	buttonPanel.add(systemBt);
	buttonPanel.add(feedsBt);
	main.setWidget(2, 2, buttonPanel);

	return main;
    }

    public Widget getLoginForm() {
	FlexTable main = new FlexTable();
	main.addStyleName("form");
	main.addStyleName("border");
	main.setWidth("100%");
	this.userName = new TextBox();
	this.userName.addStyleName("forminput");
	Label name = new Label();
	name.setText(Dictionary.getEntry(Dictionary.LABEL_LOGINNAME, name));
	main.setWidget(0, 0, name);
	name.addStyleName("formlabel");
	main.setWidget(0, 1, this.userName);

	this.password = new PasswordTextBox();
	this.password.addStyleName("forminput");
	Label passlb = new Label();
	passlb.addStyleName("formlabel");
	passlb.setText(Dictionary.getEntry(Dictionary.LABEL_PASSWORD, passlb));
	main.setWidget(1, 0, passlb);
	main.setWidget(1, 1, this.password);

	HorizontalPanel buttonPanel = new HorizontalPanel();
	Button login = new Button();
	login.setText(Dictionary.getEntry(Dictionary.BUTTON_LOGIN, login));
	login.addClickHandler(new ClickHandler() {

	    @Override
	    public void onClick(ClickEvent event) {
		login();
	    }
	});
	buttonPanel.add(login);

	Button reg = new Button();
	reg.setText(Dictionary.getEntry(Dictionary.BUTTON_REGISTER, reg));
	reg.addClickHandler(new ClickHandler() {

	    @Override
	    public void onClick(ClickEvent event) {
		final RegisterPopup popup = new RegisterPopup(LoginPanel.this.parent);
		final int x = event.getNativeEvent().getClientX();
		final int y = event.getNativeEvent().getClientY();
		popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {

		    @Override
		    public void setPosition(int offsetWidth, int offsetHeight) {
			int left = x;
			int top = y;
			popup.setPopupPosition(left, top);
		    }
		});

	    }
	});
	buttonPanel.add(reg);

	Button demo = new Button();
	demo.setText(Dictionary.getEntry(Dictionary.BUTTON_DEMO_LOGIN, demo));
	demo.addClickHandler(new ClickHandler() {

	    @Override
	    public void onClick(ClickEvent event) {
		loginDemo();
	    }
	});
	buttonPanel.add(demo);

	buttonPanel.addStyleName("buttonpanel");
	buttonPanel.setWidth("100%");
	buttonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	buttonPanel.setCellHorizontalAlignment(login, HasHorizontalAlignment.ALIGN_RIGHT);
	buttonPanel.setCellHorizontalAlignment(reg, HasHorizontalAlignment.ALIGN_LEFT);
	reg.addStyleName("button");
	login.addStyleName("button");
	main.setWidget(2, 0, buttonPanel);
	main.getFlexCellFormatter().setColSpan(2, 0, 2);
	return main;
    }

    public void login() {
	if (this.userName.getValue() == null || this.userName.getValue().length() < 1) {
	    Window.alert(Dictionary.getEntry(Dictionary.MESSAGE_LOGINNAME_REQUIRED, null));
	    return;
	}
	Feeds.getService().autenticate(this.userName.getValue(), this.password.getValue(), new AsyncCallback<InitData>() {

	    @Override
	    public void onFailure(Throwable caught) {
		Window.alert(Dictionary.getEntry(Dictionary.MESSAGE_INVALID_LOGIN, null));
	    }

	    @Override
	    public void onSuccess(InitData result) {
		if (result != null && result.getUserInfo() != null) {
		    LoginPanel.this.parent.refresh(result);
		} else {
		    Window.alert(Dictionary.getEntry(Dictionary.MESSAGE_INVALID_LOGIN, null));
		}
	    }
	});
    }

    public void loginDemo() {

	Feeds.getService().autenticateDemo(Feeds.getLanguage(), new AsyncCallback<InitData>() {

	    @Override
	    public void onFailure(Throwable caught) {
		Window.alert(Dictionary.getEntry(Dictionary.MESSAGE_INVALID_LOGIN, null));
	    }

	    @Override
	    public void onSuccess(InitData result) {
		if (result != null && result.getUserInfo() != null) {
		    LoginPanel.this.parent.refresh(result);
		} else {
		    Window.alert(Dictionary.getEntry(Dictionary.MESSAGE_INVALID_LOGIN, null));
		}
	    }
	});
    }

    private Widget getInfoTable() {
	VerticalPanel vp = new VerticalPanel();
	vp.setWidth("100%");
	vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
	final HTML ohloh = new HTML();
	vp.add(ohloh);

	final HTML donate = new HTML();
	vp.add(donate);

	DeferredCommand.add(new Command() {
	    @Override
	    public void execute() {
		//ohloh.setHTML("<script type=\"text/javascript\" src=\"http://www.ohloh.net/p/586660/widgets/project_thin_badge.js\"></script>");
		ohloh.setHTML("<img alt=\"Ohloh project report for Rsc Rssfeeds\" border=\"0\" height=\"16\" src=\"https://www.ohloh.net/p/rscrssfeeds/widgets/project_thin_badge.gif\" width=\"100\">");

		donate.setHTML("<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">"
			+ "<input type=\"hidden\" name=\"cmd\" value=\"_s-xclick\">"
			+ "<input type=\"hidden\" name=\"encrypted\" value=\"-----BEGIN PKCS7-----MIIHTwYJKoZIhvcNAQcEoIIHQDCCBzwCA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gXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0xMTEwMjQwNjA2MjNaMCMGCSqGSIb3DQEJBDEWBBRr2tvnSAADs3EVkc9WkLRD0OcIxjANBgkqhkiG9w0BAQEFAASBgLucdaflfsIsubwBma0oE/0atb8Kv+Xbyo1TNOgj9lvGpCQ3eYO4s6BT6S83RocXgVOmdUurDRGbbFe9HSI9QaRlAO+FXjIUmY9hSP36pq6g3DVuQmQYsJm0fRKVyKfzd1TqTgrsB+kUNHY6eX0lCTl43XXOXdVCpW7PPygnO14P-----END PKCS7-----\">"
			+ "<input type=\"image\" width='100' height='25'  src=\"https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online!\">"
			+ "<img alt=\"\" border=\"0\" src=\"https://www.paypalobjects.com/en_US/i/scr/pixel.gif\" width=\"1\" height=\"1\">" + "</form>");

		/*donate.setHTML("<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">"
			+ "<input type=\"hidden\" name=\"cmd\" value=\"_s-xclick\">"
			+ "<input type=\"hidden\" name=\"encrypted\" value=\"-----BEGIN PKCS7-----MIIHPwYJKoZIhvcNAQcEoIIHMDCCBywCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBHszAwwszQDbTMAPPLU264w5YgwQDrBN6wWhC4JpxQ3AuG24C5RF+7NDXadXbmRS7bHxcCHxOD/oVnTHP84fDGoomn4R+713iG4bnKwA3iaQRbhwPZ6CELEZ/J4YAW9VMQ+bn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F71ZP1LXChvsENZklGuhgZSkgZEwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTExMDgwMzA1NTg1N1owIwYJKoZIhvcNAQkEMRYEFF1qYNGOnqrY3/ehfsua37+uQPpHMA0GCSqGSIb3DQEBAQUABIGAmNXmxMJLQ2OGLRZfWBH6HN2QOMaf0Za5i9QbGOZMJPORi583n9yH2zzro2QhNGXInYw8gEIx+YOznVsDFFp5cX9VCwBY38DxrZt22s1eBkaKtElhJxTsJQnXEVNLmKlOlEqdvY3ae2LgQ2lMATZS79nBLcDyxNYEY2RmQ7KLmk8=-----END PKCS7-----\">"
			+ "<input type='image' width='100' height='25' src='https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif' border='0' name='submit' alt='PayPal - The safer, easier way to pay online!'>"
			+ "<img alt='' border='0' src='https://www.paypalobjects.com/en_US/i/scr/pixel.gif' width='1' height='1'>" + "</form>");*/
	    }
	});
	return vp;
    }
}
